/*
 * debug.h
 *
 *  Created on: 2012-08-27
 *      Author: wojciech
 */

#ifndef DEBUG_H_
#define DEBUG_H_


#define DBG_HALT							(1 << 31)
#define DBG_TOUCH							(1 << 0)
#define DBG_GUI							(1 << 1)
#define DBG_TIME							(1 << 2)
#define DBG_OFF							0
#define DBG_MASK_LEVEL						( DBG_GUI )

#define UNUSED_ARG(arg)		(void)(arg)
#ifdef __cplusplus
extern "C" {
#endif

extern int lprintf(const char *format, ...);

#define DEBUGF(debug, ...) do { \
                               if ( \
                                   ((int)((debug) & DBG_MASK_LEVEL))) { \
                                 lprintf(__VA_ARGS__); \
                                 if ((debug) & DBG_HALT) { \
                                   while(1); \
                                 } \
                               } \
                             } while(0)

#ifdef __cplusplus
}
#endif

#endif /* DEBUG_H_ */
